/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package idea.apptopcomponents;


import idea.de.explorer.IDataElemsTopComponent;
import idea.icci.explorer.CustomContentItemsTopComponent;
import idea.ipreview.IPreviewTopComponent;
import idea.iqtitles.explorer.IQuestionTitleTopComponent;
import idea.iquest.explorer.IQuestionnairesTopComponent;
import org.idea.utils.sfo.TreeTopComponent;
import org.openide.windows.WindowManager;


/**
 *
 * @author rejun001
 */
public class AppTopComponents
{

    // private OpeningEditorTopComponent oeTC = null;
    private IQuestionnairesTopComponent qnrTC = null;
    private IQuestionTitleTopComponent qtTC = null;
    private CustomContentItemsTopComponent cciTC = null;
    private IDataElemsTopComponent deTC = null;
    private TreeTopComponent treeTC = null;
    private IPreviewTopComponent prevTC = null;


    public AppTopComponents()
    {
//        if ( oeTC == null )
//        {
//            oeTC = (OpeningEditorTopComponent) WindowManager.getDefault()
//                    .findTopComponent( "OpeningEditorTopComponent" );
//        }
        if ( qnrTC == null )
        {
            qnrTC = (IQuestionnairesTopComponent) WindowManager.getDefault()
                    .findTopComponent( "IQuestionnairesTopComponent" );
        }
        if ( qtTC == null )
        {
            qtTC = (IQuestionTitleTopComponent) WindowManager.getDefault()
                    .findTopComponent( "IQuestionTitleTopComponent" );
        }
        if ( cciTC == null )
        {
            cciTC = (CustomContentItemsTopComponent) WindowManager.getDefault()
                    .findTopComponent( "CustomContentItemsTopComponent" );
        }
        if ( deTC == null )
        {
            deTC = (IDataElemsTopComponent) WindowManager.getDefault()
                    .findTopComponent( "IDataElemsTopComponent" );
        }
        if ( treeTC == null )
        {
            treeTC = (TreeTopComponent) WindowManager.getDefault()
                    .findTopComponent( "SFOModuleViewTopComponent" );
        }
        if ( prevTC == null )
        {
            prevTC = (IPreviewTopComponent) WindowManager.getDefault()
                    .findTopComponent( "IPreviewTopComponent" );
        }
    }


//    public OpeningEditorTopComponent getOeTC()
//    {
//        return oeTC;
//    }
    public IQuestionnairesTopComponent getQnrTC()
    {
        return qnrTC;
    }


    public IQuestionTitleTopComponent getQtTC()
    {
        return qtTC;
    }


    public CustomContentItemsTopComponent getCciTC()
    {
        return cciTC;
    }


    public IDataElemsTopComponent getDeTC()
    {
        return deTC;
    }


    public TreeTopComponent getTreeTC()
    {
        return treeTC;
    }


    public IPreviewTopComponent getPrevTC()
    {
        return prevTC;
    }


    public void setPrevTC( IPreviewTopComponent prevTC )
    {
        this.prevTC = prevTC;
    }


    public void closeCrudTCs()
    {
        if ( qnrTC != null )
        {
            qnrTC.close();
        }
        if ( qtTC != null )
        {
            qtTC.close();
        }
        if ( cciTC != null )
        {
            cciTC.close();
        }
        if ( deTC != null )
        {
            deTC.close();
        }
    }


    public void closeSfoTCs()
    {
        if ( treeTC != null )
        {
            treeTC.close();
        }
        if ( prevTC != null )
        {
            prevTC.close();
        }
    }

}
